package com.shootingGame.renderableClasses
{
	import flash.display.MovieClip;

	public class AttachableObject extends GameObject
	{
		
		private var _attachedTo : GameObject;
		
		public function AttachableObject(model:MovieClip, xPos:Number=0, yPos:Number=0)
		{
			super(model, xPos, yPos);
		}
		
		override public function render():void{
			super.render();
			//isRenderingEnabled = false;
		}
		
		public function get attachedTo() : GameObject{
			if(_attachedTo)
				return _attachedTo;
			else
				return null;
		}
		
		virtual public function set attachedTo(value : GameObject) {
			if(!_attachedTo){
				if(!(_attachedTo == value)){
					_attachedTo = value;
					value.addAttachment(this);
				}
			}
		}		
	}
}
